import { createRouter, createWebHistory } from 'vue-router'
import Home from './pages/Home.vue'
import CNCMachining from './pages/Services/CNCMachining.vue'
import PlasticInjectionMolding from './pages/Services/PlasticInjectionMolding.vue'
import RapidTooling from './pages/Services/RapidTooling.vue'
import RapidPrototyping from './pages/Services/RapidPrototyping.vue'
import CompressionMolding from './pages/Services/CompressionMolding.vue'
import SheetMetal from './pages/Services/SheetMetal.vue'
import Automotive from './pages/Services/Inspection/Automotive.vue'
import Aerospace from './pages/Services/Inspection/Aerospace.vue'
import MedicalDeviceAndDental from './pages/Services/Inspection/MedicalDeviceAndDental.vue'
import ConsumerProducts from './pages/Services/Inspection/ConsumerProducts.vue'
import Security from './pages/Services/Inspection/Security.vue'
import Robotics from './pages/Services/Inspection/Robotics.vue'

import InspectionProcess from './pages/QualityControl/InspectionProcess.vue'
import GDT from './pages/QualityControl/GDT.vue'
import EquipmentList from './pages/QualityControl/EquipmentList.vue'
import Certificates from './pages/QualityControl/Certificates.vue'

import CaseStudies from './pages/Resources/CaseStudies.vue'
import Blogs from './pages/Resources/Blogs.vue'
import BlogPost from '@/components/Resources/Blogs/BlogPost.vue'
import FAQs from './pages/Resources/FAQs.vue'

import AboutUs from './pages/AboutUs.vue'
import ContactUs from './pages/ContactUs.vue'

const routerHistory = createWebHistory()

const router = createRouter({
  scrollBehavior(to) {
    if (to.hash) {
      window.scroll({ top: 0 })
    } else {
      document.querySelector('html').style.scrollBehavior = 'auto'
      window.scroll({ top: 0 })
      document.querySelector('html').style.scrollBehavior = ''
    }
  },
  history: routerHistory,
  routes: [
    {
      path: '/',
      name: 'Home',
      component: Home
    },
    {
      path: '/cnc-machining',
      name: 'CNC Machining',
      component: CNCMachining
    },
    {
      path: '/plastic-injection-molding',
      component: PlasticInjectionMolding
    },
    {
      path: '/rapid-tooling',
      component: RapidTooling
    },
    {
      path: '/rapid-prototyping',
      component: RapidPrototyping
    },
    {
      path: '/compression-molding',
      component: CompressionMolding
    },
    {
      path: '/sheet-metal',
      component: SheetMetal
    },
    {
      path: '/industries',
      children: [
        {
          path: 'automotive',
          component: Automotive
        },
        {
          path: 'aerospace',
          component: Aerospace
        },
        {
          path: 'medical-device-and-dental',
          component: MedicalDeviceAndDental
        },
        {
          path: 'consumer-products',
          component: ConsumerProducts
        },
        {
          path: 'security',
          component: Security
        },
        {
          path: 'robotics',
          component: Robotics
        }
      ]
    },
    {
      path: '/inspection-process',
      component: InspectionProcess
    },
    {
      path: '/gdt',
      component: GDT
    },
    {
      path: '/equipment-list',
      component: EquipmentList
    },
    {
      path: '/certificates',
      component: Certificates
    },
    {
      path: '/case-studies',
      component: CaseStudies
    },
    {
      path: '/blogs',
      component: Blogs
    },
    {
      path: '/blog-post/:id',
      name: 'BlogPost',
      component: BlogPost
    },
    {
      path: '/faqs',
      component: FAQs
    },
    {
      path: '/about-us',
      component: AboutUs
    },
    {
      path: '/contact-us',
      component: ContactUs
    }
  ]
})

export default router
